package com.shuwang.geguo.indexview;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private MyIndex index;
    private Toast toast;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        index = (MyIndex) findViewById(R.id.indexView);
        toast = Toast.makeText(MainActivity.this,"",Toast.LENGTH_SHORT);
/*        index.setListener(new Indexview.OnIndexSelectListener() {
            @Override
            public void onItemSelect(int position, String value) {
                toast.setText(value);
                toast.show();
            }
        });*/
        index.setOnSelectIndexListener(new MyIndex.SelectIndexListener() {
            @Override
            public void showChoice(int position, String value) {
                toast.setText(value);
                toast.show();
            }
        });
    }
}
